<?php

/**
* Reply Controller
*/
class RepliesController extends AppController
{
	var $name = 'Replies';
//	var $scaffold;
	var $components = array('UserAuth', 'RequestHandler');
	var $helpers = array('Time');

	public function beforeFilter()
	{
		if ($this->RequestHandler->isAjax()) {
	        $db =& ConnectionManager::getDataSource('default');
	        $db->fullDebug = false;
	    } else {
			$this->set('project_id', $this->params['projectId']);
			$this->set('project_name', $this->params['projectName']);
		}
	}

	function add() {
		if (empty($this->data) == false) {
			$this->data['Reply']['date'] = date("Y-m-d H:i:s");
			if ($this->Reply->save($this->data['Reply'])) {
				
			}
			$replies = $this->Reply->findAllByTicketId($this->data['Reply']['ticket_id']);
			$this->set('replies', $replies);
		}
	}
}

?>